
package com.rand.beauty;

import android.os.Bundle;
import android.widget.Toast;

import com.tencent.mm.sdk.openapi.BaseReq;
import com.tencent.mm.sdk.openapi.BaseResp;
import com.tencent.mm.sdk.openapi.IWXAPI;
import com.tencent.mm.sdk.openapi.IWXAPIEventHandler;
import com.tencent.mm.sdk.openapi.WXAPIFactory;
import com.umeng.socialize.view.WXCallbackActivity;

public class WXEntryActivity extends WXCallbackActivity  implements IWXAPIEventHandler {

	 private IWXAPI api; 
	 
	 @Override  
	    public void onCreate(Bundle savedInstanceState) {  
	        super.onCreate(savedInstanceState);  
	        api = WXAPIFactory.createWXAPI(this,  
	                "wx1db33ca36f8a08a1", false);  
	        api.handleIntent(getIntent(), this);  
	    }  
	  
	    @Override  
	    public void onReq(BaseReq arg0) {  
	  
	    }  
	  
	    @Override  
	    public void onResp(BaseResp resp) {  
	        String result = "";  
	  
	        switch (resp.errCode) {  
	        case BaseResp.ErrCode.ERR_OK:  
	            result = "分享成功";  
	            break;  
	        case BaseResp.ErrCode.ERR_USER_CANCEL:   
	            break;  
	        case BaseResp.ErrCode.ERR_AUTH_DENIED:  
	            result = "分享失败";  
	            break;  
	        default:  
	        	result = "分享失败";
	            break;  
	        }  
	  
	        Toast.makeText(this, result, Toast.LENGTH_LONG).show();  
	  
	        // TODO 微信分享 成功之后调用接口  
	        this.finish();  
	    }  
	
}
